DBG_ENABLE = 0
CROSS_COMPILE_ENABLE = 1

ifeq (1, ${CROSS_COMPILE_ENABLE})
	CROSS_COMPILE := aarch64-linux-gnu-
endif

CC := $(CROSS_COMPILE)g++
RM := rm -rf

SRC_PATH_FILE := ./main.cpp \
				./src/common/*.cpp \
				./src/data/*.cpp \
				./src/device/*.cpp \
				./src/jsoncpp/*.cpp \
				./src/route/*.cpp \
				./src/serial/*.cpp \
				./src/socket/*.cpp \
				./src/trans/*.cpp \
				./src/usb/*.cpp

TARGET := ./gateway

INCLUDE_PATH := ./include

LIBRARY_PATH :=

ifeq (1, ${DBG_ENABLE}) 
    CFLAGS += -O0 -DDEBUG
endif

CFLAGS  += $(foreach dir, $(INCLUDE_PATH), -I$(dir)) -std=c++11 -lpthread

all: clean build

build:
	$(CC) $(SRC_PATH_FILE) -o $(TARGET) $(LIBRARY_PATH) $(CFLAGS)

clean:
	$(RM) $(TARGET) log*
